home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_6 / IRQ.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  7KB  |  193 lines

  1. /* $Id: irq.h,v 1.25 1998/06/04 09:55:04 jj Exp $
  2.  * irq.h: IRQ registers on the Sparc.
  3.  *
  4.  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  5.  */
  6.  
  7. #ifndef _SPARC_IRQ_H
  8. #define _SPARC_IRQ_H
  9.  
  10. #include <linux/linkage.h>
  11.  
  12. #include <asm/system.h>     /* For NCPUS */
  13. #include <asm/btfixup.h>
  14.  
  15. #define __irq_ino(irq) irq
  16. #define __irq_pil(irq) irq
  17. BTFIXUPDEF_CALL(char *, __irq_itoa, unsigned int)
  18. #define __irq_itoa(irq) BTFIXUP_CALL(__irq_itoa)(irq)
  19.  
  20. #define NR_IRQS    15
  21.  
  22. /* Get rid of this when lockups have gone away. -DaveM */
  23. #ifndef DEBUG_IRQLOCK
  24. #define DEBUG_IRQLOCK
  25. #endif
  26.  
  27. /* IRQ handler dispatch entry and exit. */
  28. #ifdef __SMP__
  29. #ifdef DEBUG_IRQLOCK
  30. extern void irq_enter(int cpu, int irq, void *regs);
  31. extern void irq_exit(int cpu, int irq);
  32. #else
  33. extern __inline__ void irq_enter(int cpu, int irq, void *regs)
  34. {
  35.     register int proc asm("g1");
  36.     proc = cpu;
  37.     __asm__ __volatile__("
  38.     mov    %%o7, %%g4
  39.     call    ___irq_enter
  40.      add    %%o7, 8, %%o7
  41. "    : "=&r" (proc)
  42.     : "0" (proc)
  43.     : "g2", "g3", "g4", "g5", "memory", "cc");
  44. }
  45.  
  46. extern __inline__ void irq_exit(int cpu, int irq)
  47. {
  48.     register int proc asm("g7");
  49.     proc = cpu;
  50.     __asm__ __volatile__("
  51.     mov    %%o7, %%g4
  52.     call    ___irq_exit
  53.      add    %%o7, 8, %%o7
  54. "    : "=&r" (proc)
  55.     : "0" (proc)
  56.     : "g1", "g2", "g3", "g4", "g5", "memory", "cc");
  57. }
  58. #endif /* DEBUG_IRQLOCK */
  59. #else
  60. #define irq_enter(cpu, irq, regs)    (local_irq_count[cpu]++)
  61. #define irq_exit(cpu, irq)        (local_irq_count[cpu]--)
  62. #endif
  63.  
  64. /* Dave Redman (djhr@tadpole.co.uk)
  65.  * changed these to function pointers.. it saves cycles and will allow
  66.  * the irq dependencies to be split into different files at a later date
  67.  * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size.
  68.  * Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  69.  * Changed these to btfixup entities... It saves cycles :)
  70.  */
  71. BTFIXUPDEF_CALL(void, disable_irq, unsigned int)
  72. BTFIXUPDEF_CALL(void, enable_irq, unsigned int)
  73. BTFIXUPDEF_CALL(void, disable_pil_irq, unsigned int)
  74. BTFIXUPDEF_CALL(void, enable_pil_irq, unsigned int)
  75. BTFIXUPDEF_CALL(void, clear_clock_irq, void)
  76. BTFIXUPDEF_CALL(void, clear_profile_irq, int)
  77. BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
  78.  
  79. #define disable_irq(irq) BTFIXUP_CALL(disable_irq)(irq)
  80. #define enable_irq(irq) BTFIXUP_CALL(enable_irq)(irq)
  81. #define disable_pil_irq(irq) BTFIXUP_CALL(disable_pil_irq)(irq)
  82. #define enable_pil_irq(irq) BTFIXUP_CALL(enable_pil_irq)(irq)
  83. #define clear_clock_irq() BTFIXUP_CALL(clear_clock_irq)()
  84. #define clear_profile_irq(cpu) BTFIXUP_CALL(clear_profile_irq)(cpu)
  85. #define load_profile_irq(cpu,limit) BTFIXUP_CALL(load_profile_irq)(cpu,limit)
  86.  
  87. extern void (*init_timers)(void (*lvl10_irq)(int, void *, struct pt_regs *));
  88. extern void claim_ticker14(void (*irq_handler)(int, void *, struct pt_regs *),
  89.                int irq,
  90.                unsigned int timeout);
  91.  
  92. #ifdef __SMP__
  93. BTFIXUPDEF_CALL(void, set_cpu_int, int, int)
  94. BTFIXUPDEF_CALL(void, clear_cpu_int, int, int)
  95. BTFIXUPDEF_CALL(void, set_irq_udt, int)
  96.  
  97. #define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level)
  98. #define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level)
  99. #define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
  100. #endif
  101.  
  102. extern int request_fast_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, __const__ char *devname);
  103.  
  104. /* On the sun4m, just like the timers, we have both per-cpu and master
  105.  * interrupt registers.
  106.  */
  107.  
  108. /* These registers are used for sending/receiving irqs from/to
  109.  * different cpu's.
  110.  */
  111. struct sun4m_intreg_percpu {
  112.     unsigned int tbt;        /* Interrupts still pending for this cpu. */
  113.  
  114.     /* These next two registers are WRITE-ONLY and are only
  115.      * "on bit" sensitive, "off bits" written have NO affect.
  116.      */
  117.     unsigned int clear;  /* Clear this cpus irqs here. */
  118.     unsigned int set;    /* Set this cpus irqs here. */
  119.     unsigned char space[PAGE_SIZE - 12];
  120. };
  121.  
  122. /*
  123.  * djhr
  124.  * Actually the clear and set fields in this struct are misleading..
  125.  * according to the SLAVIO manual (and the same applies for the SEC)
  126.  * the clear field clears bits in the mask which will ENABLE that IRQ
  127.  * the set field sets bits in the mask to DISABLE the IRQ.
  128.  *
  129.  * Also the undirected_xx address in the SLAVIO is defined as
  130.  * RESERVED and write only..
  131.  *
  132.  * DAVEM_NOTE: The SLAVIO only specifies behavior on uniprocessor
  133.  *             sun4m machines, for MP the layout makes more sense.
  134.  */
  135. struct sun4m_intregs {
  136.     struct sun4m_intreg_percpu cpu_intregs[NCPUS];
  137.     unsigned int tbt;                /* IRQ's that are still pending. */
  138.     unsigned int irqs;               /* Master IRQ bits. */
  139.  
  140.     /* Again, like the above, two these registers are WRITE-ONLY. */
  141.     unsigned int clear;              /* Clear master IRQ's by setting bits here. */
  142.     unsigned int set;                /* Set master IRQ's by setting bits here. */
  143.  
  144.     /* This register is both READ and WRITE. */
  145.     unsigned int undirected_target;  /* Which cpu gets undirected irqs. */
  146. };
  147.  
  148. extern struct sun4m_intregs *sun4m_interrupts;
  149.  
  150. /* 
  151.  * Bit field defines for the interrupt registers on various
  152.  * Sparc machines.
  153.  */
  154.  
  155. /* The sun4c interrupt register. */
  156. #define SUN4C_INT_ENABLE  0x01     /* Allow interrupts. */
  157. #define SUN4C_INT_E14     0x80     /* Enable level 14 IRQ. */
  158. #define SUN4C_INT_E10     0x20     /* Enable level 10 IRQ. */
  159. #define SUN4C_INT_E8      0x10     /* Enable level 8 IRQ. */
  160. #define SUN4C_INT_E6      0x08     /* Enable level 6 IRQ. */
  161. #define SUN4C_INT_E4      0x04     /* Enable level 4 IRQ. */
  162. #define SUN4C_INT_E1      0x02     /* Enable level 1 IRQ. */
  163.  
  164. /* Dave Redman (djhr@tadpole.co.uk)
  165.  * The sun4m interrupt registers.
  166.  */
  167. #define SUN4M_INT_ENABLE      0x80000000
  168. #define SUN4M_INT_E14         0x00000080
  169. #define SUN4M_INT_E10         0x00080000
  170.  
  171. #define SUN4M_HARD_INT(x)    (0x000000001 << (x))
  172. #define SUN4M_SOFT_INT(x)    (0x000010000 << (x))
  173.  
  174. #define    SUN4M_INT_MASKALL    0x80000000      /* mask all interrupts */
  175. #define    SUN4M_INT_MODULE_ERR    0x40000000      /* module error */
  176. #define    SUN4M_INT_M2S_WRITE    0x20000000      /* write buffer error */
  177. #define    SUN4M_INT_ECC        0x10000000      /* ecc memory error */
  178. #define    SUN4M_INT_FLOPPY    0x00400000      /* floppy disk */
  179. #define    SUN4M_INT_MODULE    0x00200000      /* module interrupt */
  180. #define    SUN4M_INT_VIDEO        0x00100000      /* onboard video */
  181. #define    SUN4M_INT_REALTIME    0x00080000      /* system timer */
  182. #define    SUN4M_INT_SCSI        0x00040000      /* onboard scsi */
  183. #define    SUN4M_INT_AUDIO        0x00020000      /* audio/isdn */
  184. #define    SUN4M_INT_ETHERNET    0x00010000      /* onboard ethernet */
  185. #define    SUN4M_INT_SERIAL    0x00008000      /* serial ports */
  186. #define    SUN4M_INT_KBDMS        0x00004000      /* keyboard/mouse */
  187. #define    SUN4M_INT_SBUSBITS    0x00003F80      /* sbus int bits */
  188.  
  189. #define SUN4M_INT_SBUS(x)    (1 << (x+7))
  190. #define SUN4M_INT_VME(x)    (1 << (x))
  191.  
  192. #endif
  193.